#ifndef __THEOJANSEN_H__
#define __THEOJANSEN_H__

#include "BaseLayer.h"

class TheoJansen : public BaseLayer {
public:
	TheoJansen() : m_chassis(NULL), m_wheel(NULL), 
		m_motorJoint(NULL), m_motorSpeed(2.0f), m_motorOn(true) { m_offset.Set(10.0f, 8.0f); }
	~TheoJansen() {}
	static CCScene* scene();
	virtual bool init();
	CREATE_FUNC(TheoJansen);

public:
	void createLeg(float32 s, const b2Vec2& wheelAnchor);
	void testJansen();

public:
	void update(float delta);

public:
	virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
	virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
	virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);

private:
	b2Vec2 m_offset;
	b2Body* m_chassis;
	b2Body* m_wheel;
	b2RevoluteJoint* m_motorJoint;
	bool m_motorOn;
	float32 m_motorSpeed;
	b2MouseJoint* m_mouseJoint;
};

#endif // __THEOJANSEN_H__